package com.fr.cell.comp;

import com.fr.cell.core.GUICoreUtils;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

public class ExpandMutableTreeNode extends DefaultMutableTreeNode
{
  private boolean isExpanded;

  public ExpandMutableTreeNode(Object paramObject)
  {
    this(paramObject, false);
  }

  public ExpandMutableTreeNode(Object paramObject, boolean paramBoolean)
  {
    super(paramObject);
    this.isExpanded = false;
    setExpanded(paramBoolean);
  }

  public boolean isExpanded()
  {
    return this.isExpanded;
  }

  public void setExpanded(boolean paramBoolean)
  {
    this.isExpanded = paramBoolean;
  }

  public void expandCurrentTreeNode(JTree paramJTree)
  {
    if (this.isExpanded)
    {
      paramJTree.expandPath(GUICoreUtils.getTreePath(this));
      setExpanded(true);
      expandSubTreeNodes(paramJTree);
    }
  }

  private void expandSubTreeNodes(JTree paramJTree)
  {
    if (!(isExpanded()))
      return;
    paramJTree.expandPath(GUICoreUtils.getTreePath(this));
    setExpanded(true);
    int i = getChildCount();
    for (int j = 0; j < i; ++j)
    {
      ExpandMutableTreeNode localExpandMutableTreeNode = (ExpandMutableTreeNode)getChildAt(j);
      if (localExpandMutableTreeNode.isExpanded())
      {
        paramJTree.expandPath(GUICoreUtils.getTreePath(localExpandMutableTreeNode));
        localExpandMutableTreeNode.setExpanded(true);
        localExpandMutableTreeNode.expandSubTreeNodes(paramJTree);
      }
    }
  }
}